Skip to content

Support extension method as Navigation property#1528

Open
genusP wants to merge 309 commits into
OData:masterfrom
genusP:nav_prop_as_extension_method
Open

Support extension method as Navigation property#1528
genusP wants to merge 309 commits into
OData:masterfrom
genusP:nav_prop_as_extension_method

Conversation

@genusP
Copy link
Copy Markdown
Contributor

@genusP genusP commented Jul 10, 2018

Issues

Some ORMs (e.g. linq2db) support define navigation properties as extension method.
This PR add functional to model builder and also update binders for support this.

Checklist (Uncheck if it is not completed)

  • Test cases added
  • Build and test with one-click build and test script passed

Additional work necessary

If documentation update is needed, please add "Docs Needed" label to the issue and provide details about the required document change in the issue.

kosinsky and others added 30 commits October 24, 2017 14:32
All tests are passsing.

WebApiPerformance.Service and WebApiPerformance.Test now compiles.
All tests are passsing.

All changes to E2E and performance tests were the addition of the
copywrite header and namespace change. There are no other E2E or
performance test code changes.

The E2E test require a client so I updated all projects (product, unit tests) to use
ODL 7.3.1 in order to pickup a client from MyGet. As part of this change,

I had to change a failing unit test due to a change in ODL:
test/UnitTest/Microsoft.Test.AspNet.OData/Query/Expressions/FilterBinderTests.cs
Fix code analysis/style copy issues.
Update msbuild scripts to 2015.
Update Nuspec files.
- Addresses OData#1085. If Column(Order) is present in the model, the keys are ordered in alphabetical order instead of using the [Column(Order=X)] attribute. This commit corrects the issue, and now "order by" will arrange keys based on Column(Order) value.
- Adds E2E tests corresponding to the code change.
To fix a few tests using FilterDataForEf and DateTime columns,
I forced the DateTime column to be type DateTime2, which can handle milliseconds.
The old tests expected the milliseconds to snap to 0.000, 0.003 & 0.007. I have
changed the tests to expect the value added by ResetDataSource(). This change also
affects the QueryEfCustomerEntityTest test, it assumed milliseconds would snap to 0.007.

Additionally, I added DropCreateDatabaseIfModelChanges() to update any existing
DBs that may exist on developers machines.

Constructor_ThrowsInvalidOperation_IfFailsToParsePathTemplate is also a bit unstable
so I ensured it has it's own instance of DefaultODataPathHandler() to avoid conflict
with other tests.
Add Adapters and Extensions for AspNetCore.
Add placeholder classes for Formatting, Results and Routing.
Refactor the UrlHelper to be seperate from the Request.
Add per-route DI continers for AspNetCore, refactored per-route containers in AspNet.
ETagMessageHandler.cs
EnableQueryAttribute.cs
DefaultODataETagHandler.cs
DefaultODataDeserializerProvider.cs
ODataDeserializerProviderProxy.cs
ODataInputFormatter.cs
ODataInputFormatterFactory.cs
ODataOutputFormatter.cs
ODataOutputFormatterFactory.cs
DefaultODataSerializerProvider.cs
CreatedODataResult.cs
UpdatedODataResult.cs
ActionRoutingConvention.cs
AttributeRoutingConvention.cs
DynamicPropertyRoutingConvention.cs
EntityRoutingConvention.cs
EntitySetRoutingConvention.cs
FunctionRoutingConvention.cs
MetadataRoutingConvention.cs
NavigationRoutingConvention.cs
NavigationSourceRoutingConvention.cs
PropertyRoutingConvention.cs
RefRoutingConvention.cs
SingletonRoutingConvention.cs
UnmappedRequestRoutingConvention.cs
ODataActionSelector.cs
ODataPathRouteConstraint.cs
ODataRoute.cs
ODataVersionConstraint.cs
SingleResult.cs
SingleResultOfT.cs

Refactor the following classes to increase shared code:
ETagMessageHandler.cs
EnableQueryAttribute.cs
ContainerBuilderExtensions.cs
DefaultODataDeserializerProvider.cs
ODataDeserializerProviderProxy.cs
DefaultODataSerializerProvider.cs
ODataDeltaFeedSerializer.cs
ODataResourceSetSerializer.cs
ODataSerializerContext.cs
ODataNullValueMessageHandler.cs
ExpressionBinderBase.cs
ODataQueryOptions.cs
ODataQueryOptionsOfTEntity.cs
ResultHelpers.cs
AttributeRoutingConvention.cs
ODataPathRouteConstraint.cs
ODataRoute.cs
ODataVersionConstraint.cs

Remove partial classes from:
ODataDeltaFeedSerializer.cs
ODataResourceSetSerializer.cs
ODataQueryContextExtensions.cs
ExpressionBinderBase.cs

Refactor HttpRequestMessageExtensions.cs to create GetNextPageHelper.cs since
GetNextPageLink does not require a request. This allows ODataDeltaFeedSerializer.cs
and ODataResourceSetSerializer.cs to become non-partial classes. However, GetNextPageHelper.cs
is partial due to differences in accessing query parameters from a Uri.

For remaining partial classes, add remarks when AspNet-specific or
AspNetCore-specific types are used.

Refactor parameter checking in routing to check public methods,
remove parameter checking from internal methods.

Assume all methods are supported for an action if no supported methods
are specified in WebApiActionDescriptor.cs.

Add IWebApiAssembliesResolver to DI container to allow shared code to access
the assembly resolver in a platform-agnostic way.

Upgrade AspNetCore to Microsoft.Extensions.DependencyInjection 2.0

Fix RouteData in AttributeRoutingConvention.cs . RouteData on the HttpContext
is not available until after routing is complete; until then, use the RouteData
from the routing context instead.

Modify PublicApiHelper.cs to allow debug version of PublicApiTest to pass.

Remove default framework from WebStack.settings.targets to allow it to be
shared with AspNetCore project.
Enable CodeAnalysis for AspNetCore + fix errors.
Enable documentation for AspNetCore + documentation comment fixes.
Update Nuget packaging for AspNet to include all source code.
Remove custom Fxcop project.
Modify product code projects to run Fxcop and StyleCop when building in VS.
Add -Q option for quick (Compile + UnitTest) builds.
… by some class constructors.

Allow action selector to pick a default method if none have matched.
Fix StackOverflow in ArgumentNullException()
Minor code cleanup.
…taOptions.

Inject settings and options into both the global and pre-request containers.
Add Fluent APIs to IRouteBuilder to configure settings and options.
Add EnableContinueOnErrorHeader for batching.
Implement NonValidatingParameterBindingAttribute.
Implement ODataNullValueMessageHandler as a IResultFilter.
Implement ODataQueryParameterBindingAttribute.
Fixed $count calculation in ODataFeature.TotalCount.
Fixed an ETag is where the etag handler was not being retrieved from the per-route service container.
Refactor EnableQueryAttribute to move model retrieval to ActionDescriptorExtensions.
Added extension methods to get and set a default time zone
Convert UnitTest projects to NetFx 4.5.2
Enable Xunit Analyzers & fix reported issues, including:
 - Assert.Equal(0, collection.Count) => Assert.Empty(collection)
 - Assert.Equal(1, collection.Count) => Assert.Single(collection)
 - Assert.Equal(var, const) => Assert.Equal(const, var)
 - Assert.True(collection.Contains(find)) => Assert.Contains(find, collection)
 - Remove duplicate Theory test cases
 - Cleanup unused Theory param warnings
 - Remove Assert.NotNull() on structs
Avoid .Wait() and .Results() in favor of async Task return for async unit tests
Cleanup unused test code.
Make OData formatters ignore non-OData requests
Implement MediaMapping for AspNetCore
Refactor MediaMappings
Move DefaultODataETagHandler to shared code
Set InternalUrlHelper in ODataDeserializerContext
Skip OData output formatting for non-OData routes.
Improved routing action selection.
Add EnableDependencyInjection() for non-OData routes.
biaol-odata and others added 20 commits November 19, 2018 18:29
…ata#1742)

* Fixes for regression described in OData#1741

- Optimizes the codepath so that primitives can be tested without a DI container.
- Adds the missed conversion for ConstantNodes.

- [X] Includes unit tests

* Update ODataModelBinderConverterTests.cs

Documentation adjustments.
…ith InvalidCastException when edmType comes from CsdlParser)

commit 0a383f4
Author: David Jackman <djackman@microsoft.com>
Date:   Wed May 8 10:49:57 2019 -0600

    Change C# 7 syntax to C# 6 compatible so StyleCop will not think it's a syntax error.

commit df18e37
Author: David Jackman <djackman@microsoft.com>
Date:   Tue May 7 16:40:25 2019 -0600

    Test and fix for issue 1802 (ODataEnumDeserializer.ReadInline fails with InvalidCastException when edmType comes from CsdlParser)
* Update to OData Library v7.6, fix the failing test cases

1. Navigation property binding sorted by the path string
2. Context Uri changes for $expand by add parathesis
3. Complex type parameter supports using ODataResourceValue
4. etc.

* remove unused changes

* Update the AspNetODataSample.Web

* Change the namespace of EntitySetTest
…or_NavigationProperties_WithComplex_Multiple for stable
…ta#1724)

* SkipToken implementation with nested nextlink

Update Microsoft.AspNet.OData.PublicApi.bsl

* make constructor and properties internal

* update public api

* Address PR comments

* Remove unnecessary lines

* Address PR comments

* Address final PR comments

* Fix perf build issues

* Address PR comments
* Support leading and trailing spaces for query options

To be more tolerant for simple typos

* More samples and better formating
* Ef Core InMemory provider works with aggregations

* $apply works with EF Core SQL provider

EF Core and EF6 need a bit different approach for aggregating IGrouping<>

* Reflect changes in BinderTests

* Comments and more EF Classic tests

* Stylecop issues

* Reaction on feedback

* Block Linq2SQL

* Added tests for enum property

* Fix typo
@genusP
Copy link
Copy Markdown
Contributor Author

genusP commented Jul 8, 2019

@mikepizzo, please review this PR.

@genusP
Copy link
Copy Markdown
Contributor Author

genusP commented Jul 16, 2019

@KanishManuja-MS Please, give me information about CI errors.

@KanishManuja-MS
Copy link
Copy Markdown
Contributor

image
image

@genusP
Copy link
Copy Markdown
Contributor Author

genusP commented Jul 17, 2019

@KanishManuja-MS Please, give me information about CI errors.

@KanishManuja-MS
Copy link
Copy Markdown
Contributor

@genusP Style issues -
image

@xuzhg xuzhg force-pushed the master branch 2 times, most recently from 4c43a84 to ddfd3dd Compare May 29, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.